import 'package:get/get.dart';
import 'package:share_fit/app/controllers/device/music/music_state.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/generated/locales.g.dart';

class MusicLogic extends GetxController {

  final MusicState state = MusicState();

  void switchMusic(int value) {
    state.musicValue = value;
    state.neteaseValue = value==0;
    state.kugouValue = value==1;
    state.qqValue = value == 2;
    update();
  }

  bool switchLogic(String id) {
    switch(id) {
      case "music_netease":
        return state.neteaseValue;
      case "music_kugou":
        return state.kugouValue;
      case "music_qq":
        return state.qqValue;
      default:
        return false;
    }
  }

  String defaultMusic() {
    if(state.neteaseValue) {
      return LocaleKeys.music_netease.ts;
    }
    if(state.kugouValue) {
      return LocaleKeys.music_kugou.ts;
    }
    if(state.qqValue) {
      return LocaleKeys.music_qq.ts;
    }
    return "";
  }
}